import request from './request';
import otherRequest from './otherRequest';

//获取猜你喜欢数据
export const like = () => {
    return request({
        url: '/like',
        method: 'get'
    })
}

//获取猜你喜欢详情
export const likeDetail = (id) => {
    return request({
        url: `/likeDetail/${id}`,
        method: 'get'
    })
}

// 获取icon列表
export const iconList = () => {
    return request({
        url: '/icon',
        method: 'get'
    })
}

// 获取验证码
export const getCode = () => {
    return request({
        url: '/code',
        method: 'get'
    })
}

// 获取演员
export const getActor = () => {
    return request({
        url: '/actor',
        method: 'get'
    })
}

// 获取电影详情
export const getMovieDetail = (id) => {
    return request({
        url: `/movieDetail/${id}`,
        method: 'get'
    })
}

// 登录接口
export const login = (data) => {
    if (data.authCode) {
        return request({
            url: `/login?phone=${data.phone}&authCode=${data.authCode}&flag=${data.flag}`,
            method: 'get'
        })
    } else {
        return request({
            url: `/login?phone=${data.phone}&password=${data.password}&flag=${data.flag}`,
            method: 'get'
        })
    }

}

// 获取用户信息
export const getUserInfo = (token) => {
    return request({
        url: `/userInfo?token=${token}`,
        method: 'get'
    })
}

// 猫眼电影列表
// export const maoYanList = () => {
//     return otherRequest({
//         url: '/movieOnInfoList',
//         method: 'get'
//     })
// }

// 猫眼电影列表
export const maoYanList = () => {
    return request({
        url: '/movie',
        method: 'get'
    })
}

// 搜索列表
export const searchCatoryList = () => {
    return request({
        url: '/searchCatory',
        method: 'get'
    })
}

// 搜索列表
export const searchList = (categoryId) => {
    return request({
        url: `/searchList/${categoryId}`,
        method: 'get'
    })
}

// 搜索列表
export const searchKeyWord = (keyWord) => {
    return request({
        url: `/searchKeyWord/${keyWord}`,
        method: 'get'
    })
}

// 历史订单
export const historyCarts = () => {
    return request({
        url: `/cartList`,
        method: 'get'
    })
}

// 新增订单
export const addCart = (data) => {
    return request({
        url: `/addCart?img=${data.img}&shopName=${data.shopName}&goodName=${data.goodName}&count=${data.count}&totalPrice=${data.totalPrice}`,
        method: 'post'
    })
}